using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class VitemActivityMap : EntityTypeConfiguration<VitemActivity>
    {
        public VitemActivityMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Date, t.number, t.Dest, t.Company });

            // Properties
            this.Property(t => t.type)
                .HasMaxLength(14);

            this.Property(t => t.Color)
                .HasMaxLength(30);

            this.Property(t => t.Size)
                .HasMaxLength(30);

            this.Property(t => t.Source)
                .HasMaxLength(6);

            this.Property(t => t.Dest)
                .IsRequired()
                .HasMaxLength(3);

            this.Property(t => t.vendor)
                .HasMaxLength(6);

            this.Property(t => t.manufaccode)
                .HasMaxLength(20);

            this.Property(t => t.Company)
                .IsRequired()
                .HasMaxLength(33);

            // Table & Column Mappings
            this.ToTable("VitemActivity");
            this.Property(t => t.Date).HasColumnName("Date");
            this.Property(t => t.number).HasColumnName("number");
            this.Property(t => t.type).HasColumnName("type");
            this.Property(t => t.Color).HasColumnName("Color");
            this.Property(t => t.Size).HasColumnName("Size");
            this.Property(t => t.Source).HasColumnName("Source");
            this.Property(t => t.Dest).HasColumnName("Dest");
            this.Property(t => t.qty).HasColumnName("qty");
            this.Property(t => t.vendor).HasColumnName("vendor");
            this.Property(t => t.season).HasColumnName("season");
            this.Property(t => t.manufaccode).HasColumnName("manufaccode");
            this.Property(t => t.Related).HasColumnName("Related");
            this.Property(t => t.Company).HasColumnName("Company");
        }
    }
}
